﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpeakupBackend.Themes
{
    public enum GroupThemeName { Red, Yellow, Orange, Blue, Violet };

    static public class GroupThemeNameParser
    {
        static public bool TryParse(string str, out GroupThemeName result)
        {
            str = str.Trim(new char[] { ' ', '\t' });

            foreach (GroupThemeName val in Enum.GetValues(typeof(GroupThemeName)))
            {
                if (val.ToString() == str)
                {
                    result = val;
                    return true;
                }
            }

            result = GroupThemeName.Blue;
            return false;
        }

        static public GroupThemeName Parse(string str)
        {
            GroupThemeName themeName;

            if (TryParse(str, out themeName))
            {
                return themeName;
            }

            throw new ArgumentException("Name");
        }
    }

}
